package com.kl.forum.service;

import com.kl.forum.dao.SshanghuMapper;
import com.kl.forum.dao.SshanghuTypeMapper;
import com.kl.forum.entity.Sshanghu;
import com.kl.forum.enums.ResultCode;
import com.kl.forum.util.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MapMerchantService {

    @Autowired
    private SshanghuMapper sshanghuMapper;

    @Autowired
    private SshanghuTypeMapper sshanghuTypeMapper;


    public ResultInfo mapList(String type) {
        ResultInfo re=new ResultInfo();
         if ("all".equals(type)||"全部".equals(type)){
             List<Sshanghu>  list=sshanghuMapper.findMapList();
             re.setData(list);
             re.setMessage(ResultCode.SUCCESS.getMsg());
             re.setCode(ResultCode.SUCCESS.getCode());
             return  re;
         }else {
             List<Sshanghu>  list=sshanghuMapper.findMapListShangHu(type);
             re.setData(list);
             re.setMessage(ResultCode.SUCCESS.getMsg());
             re.setCode(ResultCode.SUCCESS.getCode());
             return  re;
         }


    }

    public ResultInfo dituSerch(String key) {
        ResultInfo re=new ResultInfo();
        List<Sshanghu>  list =sshanghuMapper.dituSerch(key);
        re.setData(list);
        re.setMessage(ResultCode.SUCCESS.getMsg());
        re.setCode(ResultCode.SUCCESS.getCode());
        return  re;
    }

    public ResultInfo shanghuType() {
        ResultInfo re=new ResultInfo();
        List  list =sshanghuTypeMapper.shanghuType();
        re.setData(list);
        re.setMessage(ResultCode.SUCCESS.getMsg());
        re.setCode(ResultCode.SUCCESS.getCode());
        return  re;
    }

//    public ResultInfo mapList(int pageNumber, double lng, double lat, int findType, String storeType) {
//        int radius = 10;
//        if (findType==1){
//
//        }
//        if (findType==2){
//            if ("all".equals(storeType)||"全部".equals(storeType)){
//              List<Sshanghu> list=  sshanghuMapper.findOrderHot();
//            }else{
//                List<Sshanghu> list=  sshanghuMapper.findOrderHot(storeType);
//            }
//
//        }
//        if (findType==3){
//            if ("all".equals(storeType)||"全部".equals(storeType)){
//                List<Sshanghu> list=  sshanghuMapper.findOrderId();
//            }else{
//                List<Sshanghu> list=  sshanghuMapper.findOrderId(storeType);
//            }
//        }
//
//
//    }
}
